import request from '@/api/Axios/Axios'
import { BaseResponse } from '@/PageData/index'
import { UserRequest, DocumentRequest } from '@/PageData/Request'
import {BaseUrl} from '@/utils/BaseUrl/BaseUrl';

// 封装 get post 请求
class REQ {
  get<T>(url: string, params?: T): Promise<BaseResponse> {
    return request.get(BaseUrl+url, { params });
  };
  post<T>(url: string, params?: T): Promise<BaseResponse> {
    return request.post(BaseUrl+url, params);
  }
}
// 实例化请求类
const Request = new REQ();



// 登录的商品
export class LoginProduct {
  // 管理员登录
  Login(params: UserRequest) {
    return Request.post('Login/Logins', params);
  }
  Active(params: UserRequest) {
    return Request.post('Admin/ActiveUser', params);
  }
  CheckLogin() {
    return Request.get('Login/CheckLogin');
  }
}

// api 接口文档
export class DocumentProduct {
  // 添加接口文档
  AddDocument(params: DocumentRequest) {
    return Request.post('Params/AddApiDocument', params);
  }
  GetDocument(params: any) {
    return Request.get('Params/GetDocument', params);
  }
}






// 用户模块
import { UserWheres } from '@/PageData/index'
export class UserProduct {
  GetUser(params: UserWheres) {
    return Request.get("Admin/GetUser", params);
  }
  GetUserDetails(params: any) {
    return Request.get("Admin/GetSingleUserDetails", params);
  }
  UpdateUser(params: any) {
    return Request.post('Admin/UpdateUser', params);
  }
  UpdateUserJobs(params: any) {
    return Request.post('Admin/UpdateUserJobs', params);
  }
  AddUser(params: any) {
    return Request.post('Admin/AddUser', params);
  }
  GetUserInfo(params: any) {
    return Request.get('Admin/GetUserInfo', params);
  }

}


// 组织模块
export class OrganizationProduct {
  AddOrganization(params: any) {
    return Request.post("Organization/AddOrganzation", params);
  }
  GetOrganization() {
    return Request.get("Organization/GetOrganization");
  }
  GetOrganizationJobs(params: any) {
    return Request.get('Organization/GetOrganizationJobs', params);
  }
  GetJob(params: any) {
    return Request.get('Job/GetJog', params);
  }
  GetOrganizationUser(params: any) {
    return Request.get('Organization/GetOrganizationUser', params);
  }
  DelOrganization(params: any) {
    return Request.post('Organization/DelOrganization', params);
  }
  GetOrganizationDetails(params: any) {
    return Request.get('Organization/GetOrganizationDetails', params);
  }
  UpdateOrganization(params: any) {
    return Request.post("Organization/UpdateOrganization", params);
  }
  AddPersonCharge(params: any) {
    return Request.post("Organization/AddPersonCharge", params);
  }
  DelPersonCharge(params: any) {
    return Request.post("Organization/DelPersonCharge", params);
  }
}

// 权限模块
import { RightWhere } from '@/PageData/Request/index'
export class RightProduct {
  GetRight(params: RightWhere) {
    return Request.get('Right/GetRight', params);
  }
  GetRightDetails(params: any) {
    return Request.get('Right/GetRightDetails', params);
  }
  GetRightChild(params?: any) {
    return Request.get('Right/GetRightChild', params);
  }
  ActiveRight(params: any) {
    return Request.post('Right/ActiveRight', params);
  }
  OnOffRight(params: any) {
    return Request.post('Right/OnOffRight', params);
  }
  UpdateRight(params: any) {
    return Request.post('Right/UpdateRight', params);
  }
  AddRight(params: any) {
    return Request.post('Right/AddRight', params);
  }
  DelRight(params: any) {
    return Request.post('Right/DeleteRight', params);
  }

}

// 用户权限
export class UserRightProduct {
  GiveUserRight(params: any) {
    return Request.post('UserRight/GiveUserRight', params);
  }
  GetUserRightIds(params: any) {
    return Request.get('UserRight/GetUserRightIds', params);
  }
  GetUserRights() {
    return Request.get('UserRight/GetUserRight');
  }
  AuthenticationUserRights(params: any) {
    return Request.post('UserRight/AuthenticationUserRights', params);
  }
}


export class JobProduct {
  GetJog(params: any) {
    return Request.get("Job/GetJog", params);
  }
  DelJob(params: any) {
    return Request.post("Job/DelJob", params);
  }
  OnoffJob(params: any) {
    return Request.post("Job/BanJob", params);
  }
  GetJobDetails(params: any) {
    return Request.get("Job/GetSingleJob", params);
  }
  UpdateJob(params: any) {
    return Request.post("Job/UpdateJob", params);
  }
  AddJob(params: any) {
    return Request.post('Job/AddJob', params);
  }
}

export class RightConfigProduct {
  AddRightConfig(params: any) {
    return Request.post('RightConfig/AddRightConfig', params);
  }
  GetRightConfig(params: any) {
    return Request.get('RightConfig/GetAllRightConfigs', params);
  }
  OnOffRightConfig(params: any) {
    return Request.post('RightConfig/OnOffRightConfig', params);
  }
  PublishRightConfig(params: any) {
    return Request.post('RightConfig/PublishRightConfig', params);
  }
  DelConfig(params: any) {
    return Request.get('RightConfig/DelConfig', params);
  }
  GetRightConfigDetails(params: any) {
    return Request.get('RightConfig/GetConfigDetail', params)
  }
  UpdRightConfigDetails(data: any) {
    return Request.post("RightConfig/UpdRightConfigDetails", data);
  }
  SettingConfig(params: any) {
    return Request.post('RightConfig/SettingConfig', params);
  }
  GetDistributedOrga(params: any) {
    return Request.get('RightConfig/GetDistributedOrga', params);
  }
}

// 日志 接口
export class logProduct {
  GetErrorLog(params: any) {
    return Request.get('Log/GetErrorLog', params);
  }
  GetLoginLog(params: any) {
    return Request.get('Log/GetLoginLog', params);
  }
  GetActionLog(params: any) {
    return Request.get('Log/GetActionLog', params);
  }
}

